#include <iostream>
#include <string>
#include <vector>
using namespace std;

class Solution
{
public:
    int longestCommonSubsequence(string text1, string text2)
    {
        vector<vector<int>> dp(text1.size() + 1, vector<int>(text2.size() + 1, -1));
        return Search(text1, text2, 0, 0, dp);
    }

    int Search(string &t1, string &t2, int i, int j, vector<vector<int>> &dp)
    {
        if (i == t1.size() || j == t2.size())
        {
            return 0;
        }
        if (dp[i][j] != -1)
            return dp[i][j];
        if (t1[i] == t2[j])
        {
            dp[i][j] = Search(t1, t2, i + 1, j + 1, dp) + 1;
        }
        else
        {
            dp[i][j] = max(Search(t1, t2, i + 1, j, dp), Search(t1, t2, i, j + 1, dp));
        }
        return dp[i][j];
    }
};
int main()
{
    cout << "Code1143" << endl;
    Solution s;
    return 0;
}